home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / clgraph1.zip / TEST.CPP < prev    next >
C/C++ Source or Header  |  1993-09-02  |  3KB  |  81 lines

  1. #include "cl_graph.h"
  2.  
  3. int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
  4.                     LPSTR lpszCmdLine, int nCmdShow )
  5. {
  6.     // create the application
  7.     ClumsyApp app( hInstance, hPrevInstance, lpszCmdLine, nCmdShow );
  8.  
  9.     // create the window class and register it
  10.     WindowClass wc( "ClumsyTest" );
  11.     // any settings to the window class (icon, cursor, background)
  12.     // should be done before registering the window class
  13.     wc.Register();
  14.  
  15.     // create the graphic object space
  16.     Space s;
  17.  
  18.     // create the graphic objects
  19.     CRectangle r1( Coord(-220, -60), Coord(-140, 60), 0, BLACK );
  20.     CRectangle r2( Coord(-200, -40), Coord(-160, 40), 0, RED, BLUE );
  21.  
  22.     CEllipse e1( Coord(-120, -120), Coord(-40, 120), RED | BLUE );
  23.     CEllipse e2( Coord(-100, -100), Coord(-60, 100), RED, GREEN );
  24.  
  25.     CPie p1( Coord(0, -50), Coord(100, 50), Coord(40, -25), Coord(60,-25),
  26.              BLACK );
  27.     CPie p2( Coord(0, -60), Coord(100, 40), Coord(60,-35), Coord(40, -35),
  28.              RED|GREEN, (HBRUSH)GetStockObject( GRAY_BRUSH ) );
  29.  
  30.     CRectangle r3( Coord(140, 0), Coord(220, 0), 45, BLACK );
  31.     CRectangle r4( Coord(160, 0), Coord(200, 0), 45, RED, BLUE );
  32.  
  33.     // create the pens for drawing the lines and arcs
  34.     HPEN pen1, pen2, pen3;
  35.  
  36.     pen1 = CreatePen( PS_SOLID, 3, BLACK );
  37.     pen2 = CreatePen( PS_DOT, 1, RED );
  38.     pen3 = CreatePen( PS_DASH, 1, GREEN );
  39.  
  40.     Line l1( Coord(-220, -155), Coord (220, -155), pen1 );
  41.     Line l2( Coord(-220, -145), Coord (220, -145), pen2 );
  42.     Line l3( Coord(-220, -135), Coord (220, -135), pen3 );
  43.  
  44.     CArc c1( Coord(-220,-155), Coord(220,155), Coord(-220,135), Coord(220,135),
  45.              pen1 );
  46.     CArc c2( Coord(-210,-145), Coord(210,145), Coord(-220,135), Coord(220,135),
  47.              pen2 );
  48.     CArc c3( Coord(-200,-135), Coord(200,135), Coord(-220,135), Coord(220,135),
  49.              pen3 );
  50.  
  51.     // add all the objects to the space
  52.     s.AddObject( r1 );
  53.     s.AddObject( r2 );
  54.     s.AddObject( e1 );
  55.     s.AddObject( e2 );
  56.     s.AddObject( p1 );
  57.     s.AddObject( p2 );
  58.     s.AddObject( r3 );
  59.     s.AddObject( r4 );
  60.     s.AddObject( l1 );
  61.     s.AddObject( l2 );
  62.     s.AddObject( l3 );
  63.     s.AddObject( c1 );
  64.     s.AddObject( c2 );
  65.     s.AddObject( c3 );
  66.  
  67.     // create the graphic window and assign it the space created above    
  68.     GraphicWindow wnd(s);
  69.     wnd.SetTitle( "Clumsy Computing" );
  70.     wnd.Create(wc);
  71.  
  72.     // the graphic space is always centered on the screen
  73.     wnd.CenterAlways();
  74.  
  75.     // show the window on the screen
  76.     wnd.Show();
  77.  
  78.     // run the application until the window is closed
  79.     return( app.Run() );
  80. }
  81.